package br.com.automed.entity;

import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;


@Entity
@Table(name="CM_FUNCIONARIO")
@Inheritance(strategy=InheritanceType.JOINED)
@PrimaryKeyJoinColumn(name="ID_FUNCIONARIO", referencedColumnName="ID_USUARIO")
@NamedQueries({
	@NamedQuery(name="listarFuncionario", query="FROM Funcionario f WHERE f.perfil.tipoPerfil = :perfil AND f.cargo.cargo <> :cargo"),
})
public class Funcionario extends Usuario{

	public static final String NAMED_QUERY_LIST_FUNCIONARIO = "listarFuncionario";
	
	//trazer cargo com NamedQuery
	@ManyToOne()
	@JoinColumn(name="FK_CARGO", referencedColumnName="ID_CARGO")
	private Cargo cargo;
	
	//trazer status com NamedQuery
	@ManyToOne()
	@JoinColumn(name="FK_STATUS", referencedColumnName="ID_STATUS")
	private Status status;
	
	//trazer clinica com NamedQuery
	@ManyToOne()
	@JoinColumn(name="FK_CLINICA", referencedColumnName="ID_CLINICA")
	private Clinica clinica;
	
	public Funcionario() {
		cargo = new Cargo();
		status = new Status();
		clinica = new Clinica();
	}
	
	public Cargo getCargo() {
		return cargo;
	}
	public void setCargo(Cargo cargo) {
		this.cargo = cargo;
	}
	public Status getStatus() {
		return status;
	}
	public void setStatus(Status status) {
		this.status = status;
	}
	public Clinica getClinica() {
		return clinica;
	}
	public void setClinica(Clinica clinica) {
		this.clinica = clinica;
	}
	
}
